/**
 * Created by Administrator on 16-2-19.
 */
$().ready(function () {
    $('input,select').addClass('form-control');
    $(':submit,:reset').removeClass('form-control').addClass('btn btn-default');
    $('#id_fileupload').uploadify({
        'swf': '/static/uploadify/uploadify.swf',
        'method': 'post',
        'canelImg': '/static/uploadify/uploady-cancel.png',
        'fileTypeExts': '*.jpg;*.gif;*.png',
        'fileSizeLimit': '5MB',
        'buttonText': '头像上传',
        'uploader': '/portrait/',
        'onUploadSuccess': function (file, data, response) {
            var $data = $.parseJSON(data);
            alert($data.info);
            window.location.reload();
        },
        'onUploadError': function (file, errorCode, errorMsg, errorString) {
            alert('The file ' + file.name + ' could not be uploaded: ' + errorString);
        }
    });
    KindEditor.ready(function (k) {
//        window.editor = k.create('textarea',{
//            width:'100px'
//        });
        var options = {
//            minWidth:'200px',
//            width:'400px'
            resizeType:1,
            uploadJson : '/signature/img',
            themeType: 'default',
            items: [
                'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
                'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
                'insertunorderedlist', '|', 'emoticons', 'image', 'link'
            ],
            useContextmenu: false,
            autoHeightMode : true,
					afterCreate : function() {
						this.loadPlugin('autoheight');
					}
        };
        var editor = k.create('textarea', options);
    });
})
